package com.bupt.smart.utils;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;

/**
 * Created by HH on 2016/5/23.
 */
public class GeneratetoBitmap {
    /*
   * 解析字节数组字符串为Bitmap
   * @param:   imgstr
   *               字节数组字符串
   * @return:  bitmap
   *               返回bitmap
   * */
    public static Bitmap GenerateImage(String imgstr){
        Bitmap bitmap;
        if(imgstr==null)
            return null;
        byte[] imgbyte = Base64.decode(imgstr, Base64.DEFAULT);//android base64解码
        bitmap = BitmapFactory.decodeByteArray(imgbyte, 0, imgbyte.length);
        return bitmap;
    }
}
